//
// Created by Aron on 2024/10/31.
//

#include "Speed_control.h"
void Speed_out(float set_speed,float ref_speed,int16_t max_speed_change,
              pid_type_def* pid_speed){
    float set_speed_temp,delta;
    delta = set_speed - ref_speed;

    if (delta > max_speed_change)
        set_speed_temp = (float)(ref_speed + max_speed_change);
    else if (delta < -max_speed_change)
        set_speed_temp = (float)(ref_speed- max_speed_change);
    else
        set_speed_temp = set_speed;
    PID_calc(pid_speed, ref_speed, set_speed_temp);
}